package com.css.zfzx.sjcj.modules.yhdisaster.repository;

import com.css.zfzx.sjcj.modules.yhdisaster.repository.entity.YhDisasterEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author lxg
 * @date 2020-11-10
 */
public interface YhDisasterRepository extends JpaRepository<YhDisasterEntity, String> {

    List<YhDisasterEntity>  findByYhCodeAndIsValid(String code,String isValid);
    @Modifying
    @Query( nativeQuery=true,value="update yh_disaster set quality_result =:status,qualityinspection_comments =:reason where id in :idList")
    void updateData(String status, String reason,List<String> idList);

    @Modifying
    @Query( nativeQuery=true,value="update yh_disaster set quality_result =:qualityResult,qualityinspection_comments =:qualityComments where id in :idList")
    void updateData1(String qualityResult, String qualityComments,List<String> idList);
    YhDisasterEntity findByIdAndIsValid(String id,String isValid);
}
